﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Framework.UI.Controls"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/FocusVisualStyle.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Geometry.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Controls/Expander.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="BorderThickness" Value="0, 0, 1, 0"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left,Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ExpanderMenuItem}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <ContentControl Focusable="False"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentControl.Content>
                                <Path Data="{TemplateBinding Icon}"
                                      Fill="{TemplateBinding Foreground}"
                                      Height="15"
                                      Margin="{TemplateBinding Padding}"
                                      SnapsToDevicePixels="True"
                                      Stretch="Uniform"
                                      Width="15"/>
                            </ContentControl.Content>
                        </ContentControl>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsColoursInverted" Value="True">
                            <Setter Property="Background" Value="{StaticResource ContrastBrush}"/>
                            <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
                            <Setter Property="Foreground" Value="{StaticResource AccentBrush}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{StaticResource ForegroundBrush}"/>
                            <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" Value="{StaticResource LowlightBrush}"/>
                            <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                        <DataTrigger Binding="{Binding Path=ExpandDirection, RelativeSource={RelativeSource AncestorType={x:Type controls:ExpanderMenu}}}" Value="Left">
                            <Setter Property="BorderThickness" Value="1, 0, 0, 0"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=ExpandDirection, RelativeSource={RelativeSource AncestorType={x:Type controls:ExpanderMenu}}}" Value="Up">
                            <Setter Property="BorderThickness" Value="0, 1, 0, 0"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=ExpandDirection, RelativeSource={RelativeSource AncestorType={x:Type controls:ExpanderMenu}}}" Value="Down">
                            <Setter Property="BorderThickness" Value="0, 0, 0, 1"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="DeleteExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource Delete1Geometry}"/>
        <Setter Property="ToolTip" Value="Delete"/>
    </Style>
    <Style x:Key="UpExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource RoadForwardGeometry}"/>
        <Setter Property="ToolTip" Value="Up"/>
    </Style>
    <Style x:Key="DownExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource RoadBackwardGeometry}"/>
        <Setter Property="ToolTip" Value="Down"/>
    </Style>
    <Style x:Key="EditExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource Edit2Geometry}"/>
        <Setter Property="ToolTip" Value="Edit"/>
    </Style>
    <Style x:Key="TrashExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource TrashGeometry}"/>
        <Setter Property="ToolTip" Value="Remove"/>
    </Style>
    <Style x:Key="OpenExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource Open2Geometry}"/>
        <Setter Property="ToolTip" Value="Remove"/>
    </Style>
    <Style x:Key="AddExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource Add1Geometry}"/>
        <Setter Property="ToolTip" Value="Remove"/>
    </Style>
    <Style x:Key="CopyExpanderMenuItemStyle" BasedOn="{StaticResource {x:Type controls:ExpanderMenuItem}}" TargetType="{x:Type controls:ExpanderMenuItem}">
        <Setter Property="Icon" Value="{StaticResource CopyGeometry}"/>
        <Setter Property="ToolTip" Value="Copy"/>
    </Style>
    
    <Style TargetType="{x:Type controls:ExpanderMenu}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ExpanderMenu}">
                    <Expander IsExpanded="{TemplateBinding IsExpanded}"
                              ExpandDirection="{TemplateBinding ExpandDirection}"
                              Style="{StaticResource NoHeaderExpanderStyle}">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Expander>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="ExpandDirection" Value="Up">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="ExpandDirection" Value="Down">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>